Setup

First let’s set up our chunk options and required libraries. This will minimize clutter and remove unnecessary messages and warnings.

Load data

Next we load our dataset from OpenDataPhilly.org. This dataset is a GeoJSON of all the parks in Philadelphia. We use sf::st_read() to read in spatial data like this.

Preview data

Let’s preview our data. Using mapview::mapview(), we can quickly check what the data looks like. This is useful for when you are manipulating spatial data and need to check if things look right at each step.

mapview(parks, col.regions = "chartreuse3", map.types = "CartoDB.DarkMatter")

Map the data

Finally, let’s map using ggplot2. Add your name as a subtitle in the labs() function. Also feel free to change the colors and other aesthetics. Once you’re satisfied, save and commit.

ggplot() +
  geom_sf(data = parks, fill = "chartreuse4", color = "transparent") +
  labs(title = "Philadelphia Park System, 2023") + 
  theme_void()